/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package runapplication;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

/**
 *
 * @author mani
 */
public class S2D {

    private String form;

    public S2D(String format) {
        form = format;
    }

    Date getDate() throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyy-MM-dd");
        Date parse = simpleDateFormat.parse(form);
        return parse;
    }

    Date getToday() {
        Date now = new Date();
        return new Date(now.getTime());
    }

    String getTodayChinese() {
       Calendar instance = Calendar.getInstance();
        int year = instance.get(Calendar.YEAR);
        int month = instance.get(Calendar.MONTH);
        int day = instance.get(Calendar.DAY_OF_MONTH);
        return  year +"-"+(month+1)+"-"+day;
    }
}
